<template>
  <div class="box">
    <Person v-show="onShow" />
    <button @click="updateShow()">{{title}}</button>
  </div>
</template>

<script lang="ts" setup name="App">
  import { ref, computed } from 'vue';
  import Person from './components/Person.vue'
  let onShow = ref(true);


  // 方法
  function updateShow () {
    onShow.value = !onShow.value;
    console.log("状态：", onShow.value);
  }
  const title = computed(() => {
    return onShow.value ? '隐藏' : '显示';
  })
</script>

<style scoped>
  .box {
    width: 500px;
    height: 300px;
    padding: 50px;
  }

  h2 {
    background-color: aquamarine;
  }

  button {
    margin-top: 10px;
    width: 100%;
    height: 60px;
    border: unset;
    font-size: 20px;
    color: black;
    background-color: rgba(248, 172, 8, 0.533);
  }
</style>